package meiRiYiTi;

/**
 * Author: 笨蛋超人不会飞
 * Date:  9:34
 */
public class day_1953 {
    public long numberOfWeeks(int[] milestones) {
        //统计数组的总个数以及最大值
        long  max=0;
        long sum=0;
        for (int  i = 0; i < milestones.length; i++) {
            if(milestones[i]>max){
                max=milestones[i];
            }
            sum+=milestones[i];
        }

        long temp=sum%2==0?sum/2:sum/2+1;
        if(max<=temp){
            return sum;
        }else{
            return (sum-max)*2+1;
        }


    }
}
